<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String ctx = request.getContextPath();
    request.setAttribute("ctx", ctx);
%>
<html>
<head>
    <title>POM 项目</title>
<%--    <script src="js/jquery-1.8.2.min.js"></script>--%>
    <script src="js/jquery-1.9.1.min.js"></script>
    <script src="bootstrap-4.6.0-dist/js/bootstrap.js"></script>
    <script src="js/fileupload.js"></script>
    <link rel="stylesheet" href="bootstrap-4.6.0-dist/css/bootstrap.css">
    <link rel="stylesheet" href="css/img.css">
            <link rel="stylesheet" href="css.css">
</head>
<body>
<div class="row">
    <div class="row-3">
        <jsp:include page="/layout/left1.jsp"></jsp:include>
    </div>
    <div class="row-9">
        <form action="list.do" method="post">
                <input type="hidden" name="cpage">
            仓库编号:<input type="text" name="mmid" value="${map.mmid}">
            库区:<input type="text" name="kuqu" value="${map.kuqu}">
            物料编号:<input type="text" name="wuliaobianhao" value="${map.wuliaobianhao}"><br>
            市场价:<input type="text" name="priceX" value="${map.priceX}">-<input type="text" name="priceD" value="${map.priceD}"><br>
            数量:<input type="text" name="numX" value="${map.numX}">-<input type="text" name="numD" value="${map.numD}"><br>
            金额:<input type="text" name="zongjineX" value="${map.zongjineX}">-<input type="text" name="zongjineD" value="${map.zongjineD}">
                <input type="submit" value="查询"><br>
            <a href="list1.do">仓库编号降序</a>
            <a href="list2.do">库区</a>
            <a href="list3.do">仓位</a>
<%--            <a href="list2.do">仓库编号 降序</a><br>--%>
<%--            <a href="list2.do">库区</a>--%>
<%--            <a href="list3.do">仓位</a>--%>
        </form>
        <table border="1" class="container">
            <tr>
                <td>仓库编号</td>
                <td>仓库名称</td>
                <td>库区</td>
                <td>仓位</td>
                <td>物料编号</td>
                <td>物料名称</td>
                <td>市场价</td>
                <td>数量</td>
                <td>金额</td>
                <td>仓管员工号</td>
                <td>仓管员</td>
                <td>备注</td>
                <td>操作</td>
                <td>操作</td>
            </tr>
            <c:forEach items="${pageInfo.list}" var="li">
                <tr>
                    <td>${li.oid}</td>
                    <td>${li.mname}</td>
                    <td>${li.kuqu}</td>
                    <td>${li.kuwei}</td>
                    <td>${li.wuliaobianhao}</td>
                    <td>${li.wuliaomingcheng}</td>
                    <td>${li.price}</td>
                    <td>${li.num}</td>
                    <td>${li.zongjine}</td>
                    <td>${li.zhidanrengonghao}</td>
                    <td>${li.zhidanren}</td>
                    <td>${li.beizhu}</td>
                    <td>
                        <button value="${li.oid}" class="xiut">修改</button>
                    </td>
                    <td>
                        <button value="${li.oid}" class="del">出库</button>
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="20">
<%--                    <input type="button" value="首页" onclick="fenye(1)">--%>
<%--                    <input type="button" value="上一页" onclick="fenye(${pageInfo.isIsFirstPage()?1:pageInfo.prePage})">--%>
<%--                    <input type="button" value="下一页" onclick="fenye(${pageInfo.isIsLastPage()?pageInfo.pages:pageInfo.nextPage})">--%>
<%--                    <input type="button" value="尾页" onclick="fenye(${pageInfo.pages})">--%>
                    <input type="button" value="收货入库" onclick="toupd()">
                </td>
            </tr>
        </table>
    </div>
</div>
</body>
<script>
    function fenye(cpage) {
        $("[name='cpage']").val(cpage)
        $("form").submit()
    }
    function toupd() {
        location="toupd.do"
    }
    $(".xiut").click(function () {
        let oid = $(this).val();
        location="xiut.do?oid="+oid
    })

    $(".del").click(function () {
        let val = $(this).val();
        $.ajax({
            url:"del.do",
            data:{"snowid":val},
            type:"post",
            dataType:"json",
            success:function (obj) {
                if (obj>0){
                    alert("删除成功")
                    location="list.do"
                }
            }
        })
    })
</script>
</html>
